import Router from "@koa/router";
import { signXbogus, signAbogus } from '../lib/signature.js'

function _signXbogus(ctx, next) {
    ctx.verifyParams({
        roomId: "string",
        userUniqueId: "string",
    });
    const { roomId, userUniqueId } = ctx.request.body;
    ctx.ok(signXbogus(roomId, userUniqueId));
}
function _signAbogus(ctx, next) {
    const { url, params } = ctx.request.body;
    const abogus = signAbogus(url, params)
    params["a_bogus"] = abogus
    ctx.ok({ params });
}

const router = new Router({ prefix: "/signature" });
router.post("/signXbogus", _signXbogus);
router.get("/signAbogus", _signAbogus);

export default router;
